﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="JT_SaleAdd.aspx.cs" Inherits="JTicket.UI.JT_SaleAdd" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
  <script type="text/javascript">
      //页面初始下载
      $(document).ready(function () {
          if (Flag == "Edite") {
              $("#BtnAdd").hide();

              JTicket.UI.Service.JT_StatSvc.GetModel(ID,
            function Success(Reuslt) {
                if (Reuslt != null) {
                    //*****绑定下拉框

                    $("#txtSaleCode").val(Reuslt.SaleCode);
                    $("#txtSaleName").val(Reuslt.SaleName);
                    $("#txtp1").val(Reuslt.Port1);
                    $("#txtp2").val(Reuslt.port2);
                    $("#txtp3").val(Reuslt.port3);
                    $("#txtNote").val(Reuslt.Note);
                } else { window.location.href = "JT_SaleManager.aspx"; }
            },
            function Fail(Reuslt) { isAlertError(); });

          } else { $("#BtnEdite").hide(); }
      });
      //添加
      function Add() {
          var model = new JTicket.Model.C_StatInfo();
          model.ThCode = "1";
          model.ThName = "";
          model.StatCode = "";
          model.SaleCode = $("#txtSaleCode").attr("value");
          model.SaleName = $("#txtSaleName").attr("value");
          model.Note = $("#txtNote").attr("value");
          model.Port1 = $("#txtp1").attr("value");
          model.port2 = $("#txtp2").attr("value");
          model.port3 = $("#txtp3").attr("value");

          JTicket.UI.Service.JT_SaleSvc.Add(model,
    function Success(Result)
    { alert(Result); },
    function fail(Result) {
        isAlertError();
    });
      }
      //修改
      function Update() {

          var model = new JTicket.Model.C_StatInfo();
          model.ThCode = "1";
          model.ThName = "";
          model.StatCode = "";
          model.SaleCode = $("#txtSaleCode").attr("value");
          model.SaleName = $("#txtSaleName").attr("value");
          model.Note = $("#txtNote").attr("value");
          model.Port1 = $("#txtp1").attr("value");
          model.port2 = $("#txtp2").attr("value");
          model.port3 = $("#txtp3").attr("value");


          JTicket.UI.Service.JT_SaleSvc.Update(model,
            function Success(Result) { alert("修改成功！"); },
            function fail(Result) { isAlertError(); });

      }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="sm" runat="server">
        <Services>
            <asp:ServiceReference InlineScript="true" Path="~/Service/JT_SaleSvc.asmx" />
        </Services>
    </asp:ScriptManager>
    <table align="center" border="0" cellpadding="4" cellspacing="1" class="toptable grid"
        width="100%">
        <tr>
            <td class="category t2" height="25" width="100">
                售票窗口添加
            </td>
            <td class="category" height="25">
            </td>
        </tr>
    </table>
    <table cellpadding="1" cellspacing="1" id="TbInfo" class="TbInfo">
        <tr>
            <td align="right" bgcolor="#3890B5" class="B" style="width: 130px">
                名称
            </td>
            <td height="25" align="right" bgcolor="#3890B5" class="B">
                操作
            </td>
            <td align="right" bgcolor="#3890B5" class="B" style="width: 50px">
                说明
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                所属售票站点：</td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <select id="seCompany" name="S3">
                    <option></option>
                </select><select id="seTheater" name="S4">
                    <option></option>
                </select><select id="seStat" name="S5">
                    <option></option>
                </select></td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                售票窗口编号：
            </td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtSaleCode" type="text" />
            </td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                必填
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                售票窗口名称：
            </td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtSaleName" type="text" style="width: 300px;" />
            </td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                Port1:</td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtp1" type="text" style="width: 300px;" /></td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                Port2:</td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtp2" type="text" style="width: 300px;" /></td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px; height: 25px;">
                Port3:</td>
            <td align="left" bgcolor="#F6F6F6" style="height: 25px">
                <input id="txtp3" type="text" style="width: 300px;" /></td>
            <td bgcolor="#F6F6F6" style="height: 25px; width: 171px;">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px;">
                备注：
            </td>
            <td bgcolor="#F6F6F6" style="width: 130px;">
                <textarea id="txtNote" class="textarea" cols="20" name="S1" rows="20"></textarea>
            </td>
            <td bgcolor="#F6F6F6" style="width: 171px;">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#F6F6F6" style="width: 130px">
            </td>
            <td height="25" bgcolor="#F6F6F6" align="center">
                <input type="button" id="BtnAdd" value="添  加" onclick="Add();" onmousemove="showBtnOver(this)"
                    onmouseout="showBtnOut(this)" class="submitMiniGreen" />
                <input type="button" id="BtnEdite" value="修  改" onclick="Update();" onmousemove="showBtnOver(this)"
                    onmouseout="showBtnOut(this)" class="submitMiniGreen" />
                <input type="button" id="BtnBack" value="返  回" onclick="javascript:window.location.href ='JT_StatManage.aspx'"
                    onmousemove="showBtnOver(this)" onmouseout="showBtnOut(this)" class="submitMiniGreen" />
            </td>
            <td bgcolor="#F6F6F6" style="width: 171px">
                &nbsp;
            </td>
        </tr>
    </table>
</asp:Content>
